<template>
    <div class="goodsInfo">
        <h4>{{ goodsInfo.title }}</h4>
        <hr>
        <div class="goods-info" v-html="goodsInfo.content"></div>
    </div>
</template>
<script>
    import { Toast } from 'mint-ui'
    export default {
        data() {
            return {
                goodsInfo:{},
            }
        },
        created(){
            this.getGoodsInfo();
        },
        methods:{
            //获取商品购买详情页的数据
            getGoodsInfo(){
                this.$http.get('api/goods/getdesc/'+this.$route.query.id).then( result=>{
                    if(result.body.status === 0){
                        console.log(result.body.message);
                        this.goodsInfo = result.body.message[0]; 
                    }else{
                        Toast({
                            message: '商品购买详情页数据失败',
                            position: 'middle',
                            duration: 2000
                        });
                    }
                });
            }
        },
    }
</script>

<style lang="less">
    .goodsInfo{
        padding: 0 4px;
    }
    .goods-info{
        margin-top: 10px;
        color: #8f8f94;
        line-height: 24px;
        font-size: 16px;
        table{
            width: 100%;
        }
        img{
            max-width: 100%;
        }
    }
</style>
